import http from './http';

export default {
  /** 规格相关 ****************/

  /**
   * @description: 新增规格尺寸
   * @param {type}
   * @return:
   */
  addSpecification(data) {
    return http.post(`/mall/web/product/v1/specification/add`, data).exec();
  },
  /**
   * @description: 查询商家所有的规格
   * @param {type}
   * @return:
   */
  getSpecificationList() {
    return http.get(`/mall/web/product/v1/specification/list`).exec();
  },
  /**
   * @description: 删除规格 把整个规格＋下面的属性都删了
   * @param {type}
   * @return:
   */
  deleteSpecification(params) {
    return http.post(`/mall/web/product/v1/specification/delete`, params).exec();
  },

  /** 属性相关 ****************/

  /**
   * @description: 列出规格下面所有的属性
   * @param { specId - id }
   * @return:
   */
  getPropertyListBySpecId(params) {
    return http.get(`/mall/web/product/v1/specification/property/${params}`).exec();
  },
  /**
   * @description: 新增规格属性
   * @param {type}
   * @return:
   */
  addProperty(data) {
    return http.post(`/mall/web/product/v1/specification/property/add`, data).exec();
  },

  /**
   * @description: delete规格属性:必须带上ID主键
   * @param {type}
   * @return:
   */
  deleteProperty(id) {
    return http.post(`/mall/web/product/v1/specification/property/delete/${id}`).exec();
  },
};
